﻿//----------------------------------------------------------------------- 
// PDS WITSMLstudio Store, 2018.1
//
// Copyright 2018 PDS Americas LLC
// 
// Licensed under the PDS Open Source WITSML Product License Agreement (the
// "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//   
//     http://www.pds.group/WITSMLstudio/OpenSource/ProductLicenseAgreement
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//-----------------------------------------------------------------------

// ----------------------------------------------------------------------
// <auto-generated>
//     Changes to this file may cause incorrect behavior and will be lost
//     if the code is regenerated.
// </auto-generated>
// ----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using Energistics.DataAccess;
using Energistics.DataAccess.WITSML131;
using Energistics.DataAccess.WITSML131.ComponentSchemas;
using Energistics.DataAccess.WITSML131.ReferenceData;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace PDS.WITSMLstudio.Store.Data.Realtimes
{
    public abstract partial class Realtime131TestBase : IntegrationTestBase
    {

        public const string QueryMissingNamespace = "<realtimes version=\"1.3.1.1\"><realtime /></realtimes>";
        public const string QueryInvalidNamespace = "<realtimes xmlns=\"www.witsml.org/schemas/123\" version=\"1.3.1.1\"></realtimes>";
        public const string QueryMissingVersion = "<realtimes xmlns=\"http://www.witsml.org/schemas/131\"></realtimes>";
        public const string QueryEmptyRoot = "<realtimes xmlns=\"http://www.witsml.org/schemas/131\" version=\"1.3.1.1\"></realtimes>";
        public const string QueryEmptyObject = "<realtimes xmlns=\"http://www.witsml.org/schemas/131\" version=\"1.3.1.1\"><realtime /></realtimes>";

        public const string BasicXMLTemplate = "<realtimes xmlns=\"http://www.witsml.org/schemas/131\" version=\"1.3.1.1\"><realtime uid=\"{0}\">{1}</realtime></realtimes>";

        public Realtime Realtime { get; set; }

        public DevKit131Aspect DevKit { get; set; }

        public List<Realtime> QueryEmptyList { get; set; }

        [TestInitialize]
        public void TestSetUp()
        {
            Logger.Debug($"Executing {TestContext.TestName}");
            DevKit = new DevKit131Aspect(TestContext);

            DevKit.Store.CapServerProviders = DevKit.Store.CapServerProviders
                .Where(x => x.DataSchemaVersion == OptionsIn.DataVersion.Version131.Value)
                .ToArray();

            Realtime = new Realtime
            {

                Uid = DevKit.Uid(),
                Name = DevKit.Name("Realtime")
            };

            QueryEmptyList = DevKit.List(new Realtime());

            BeforeEachTest();
            OnTestSetUp();
        }

        [TestCleanup]
        public void TestCleanUp()
        {
            AfterEachTest();
            OnTestCleanUp();
            DevKit.Container.Dispose();
            DevKit = null;
        }

        partial void BeforeEachTest();

        partial void AfterEachTest();

        protected virtual void OnTestSetUp() { }

        protected virtual void OnTestCleanUp() { }

        protected virtual void AddParents()
        {

        }
    }
}
